<template>
	<view>
		<Header title="补卡" :showBack="true"></Header>
		<view class="container">
			<view class="content-box">
				<view class="info">
					<view class="ava">
						<!-- <open-data style="width: 100%; height: 100%;" type="userAvatarUrl"></open-data> -->
					</view>
					<view>
						<view>IC卡号：{{info.cardNo||'无'}}</view>
						<view>余&#12288;额：{{info.amount||'无'}}</view>
						<view>姓&#12288;名：{{info.ownerName||'无'}}</view>
						<view>状&#12288;态：{{info.statusFlagName||'无'}}</view>
					</view>
				</view>
				<view class="box">
					<!-- <view>
						申请补卡后将清空原有实体卡余额
					</view>
					<view>
						钱款将保留在本手机对应的会员卡
					</view>
					<view>
						您可以通过本程序绑定新的会员卡
					</view>
					<view>
						重新绑定实体卡后会同步余额
					</view> -->
					<button @click="summit" type="default">申请补卡 (补卡费用5元)</button>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:uni.getStorageSync('info'),
				appId:getApp().globalData.appId,
			}
		},
		methods: {
			summit(){
				this.$http('/minprogram/api/member/replacement',{
					    "paymentType":1,
						"payType":12,
						"cardNo":this.info.cardNo,
						"openId":uni.getStorageSync('openId'),
						"appid": this.appId,
						"replacementAmount":5,
				},res=>{
					this.$http('/pay/api/pay/pay',res.data,pay=>{
						uni.requestPayment({
						    provider: 'wxpay',
						    timeStamp: pay.data.timeStamp,
						    nonceStr: pay.data.nonceStr,
						    package: pay.data.package,
						    signType: pay.data.signType,
						    paySign: pay.data.paySign,
						    success: function (res1) {
										uni.showModal({
											content: '您的申请已提交，后续我们会致电联系您'
										})
						    },
						    fail: function (err) {
						    }
						});
					})
					
				})
			}
		}
	}
</script>

<style scoped lang="less">
.info{
		width: 100%;
		display: flex;
		padding-top: 20upx;
		.ava{
				width: 30upx;
				height: 150upx;
				border-radius: 10%;
				overflow: hidden;
				margin: 0 50upx;
				position: relative;
				top: 16upx;
			// width: 150upx;
			// height: 150upx;
			// border-radius: 50%;
			// overflow: hidden;
			// margin:0 50upx;
			// position: relative;
			// top: 16upx;
		}
		>view:nth-child(2){
			font-size: 30upx;
			>view{
				margin-bottom: 6upx;
			}
		}
	}
	.bg{
		width: 100%;
		background-image: url(../../static/img/bg.png);
		height: 100upx;
		background-size: 100% 100%;
	}
	.box{
		width: 93%;
		// background-color: #FFFFFF;
		padding: 50upx 0upx 30upx;
		box-sizing: border-box;
		margin: 20upx auto;
		border-radius: 10upx;
		>view{
			font-size: 26upx;
			padding: 0 100upx;
			height: 30upx;
			line-height: 30upx;
			margin-bottom: 50upx;
		}
		button{
			margin: 20vh auto 0;
			background-color: #49b9ad;
			height: 80upx;
			line-height: 80upx;
			font-size: 30upx;
			color: #FFFFFF;
		}
	}
	.content-box{
		background: #fff;
		border-radius: 16upx;
		box-shadow: 0 3upx 20upx 1upx rgba(247, 200, 122, .2);
	}
</style>
